package headfirst.designpatterns.factory.b_cars_factorymothod.z_run_test;

import headfirst.designpatterns.factory.b_cars_factorymothod.car.Car;
import headfirst.designpatterns.factory.b_cars_factorymothod.factory.BenzDriver;
import headfirst.designpatterns.factory.b_cars_factorymothod.factory.BmwDriver;
import headfirst.designpatterns.factory.b_cars_factorymothod.factory.Driver;

//老板
public class Boss {

    public static void main(String[] args) throws Exception {
        /**
         *  Driver bmwDriver = new BmwDriver();
         *  Car bmw = bmwDriver.createCar("bmw");
         *  这两行可以简化到多一层中，重点看这俩
         *          Driver benzDriver，Car c
         */
        Driver benzDriver = new BenzDriver();
        Car benz = benzDriver.createCar("benz");
        benz.setName("benz");
        benz.drive();

        Driver bmwDriver = new BmwDriver();
        Car bmw = bmwDriver.createCar("bmw");
        bmw.setName("bmw");
        bmw.drive();

    }
} 